<admintpl file="header"/>
<style>
.home_info li em {
float: left;
width: 100px;
font-style: normal;
}
li {
list-style: none;
}

</style>
</head>

<body>
<div class="wrap">
  <div id="home_toptip"></div>
  <h4 class="well">系统信息</h4>
  <div class="home_info">
    <ul>
      <volist name="server_info" id="vo">
        <li> <em>{$key}</em> <span>{$vo}</span> </li>
      </volist>
    </ul>
  </div>
  <h4 class="well">工作量统计</h4>
  <div>
  <php>
      $t = $num = 0;
        $p_name = array();
    $users_obj = D("Users");
    $users_data=$users_obj->field("user_login,id")->where("user_type = 1 && user_status = 1")->select();
    foreach ($users_data as $u){
           $u_name[$t][id] = $u['id'];
           $u_name[$t][name] = $u['user_login'];
           $t++;
    }
      $t = 0;
        $posts_obj = D("Posts");
        for($i = 0;$i < sizeof($u_name);$i++)
        {
            $posts_date=$posts_obj->field("post_author,post_date")->where("post_author =".$u_name[$i]['id'])->select();
            foreach ($posts_date as $p){
            $p_date[$t][id] = $p['post_author'];
            $p_date[$t][name] = $u_name[$i][name];
            $p_date[$t][date] = $p['post_date'];
            $t++;
            }
        }
  </php>
    <ul class="inline" style="margin-left: 25px;">
      <table border="1">
  <tr>
    <th>用户名</th>    
  <php>
      for($i = 0;$i < sizeof($p_date);$i++)
        {
          if($p_date[$i]['id'] != $p_date[$i+1]['id'])
            {
              echo '<th style="width:80px;">'.$p_date[$i]['name'].'</th>';
            }
        }
        
        //统计正常发布文章的用户ID
    </php>
  </tr>
  <tr>
    <th><php>echo date("Y - m - d");</php></th>
    <php>
        for($i = 0;$i < sizeof($p_date);$i++)
        {
            $date = $p_date[$i]['date'];
            if(date("Y-m-d",strtotime("$date")) == date("Y-m-d"))
            {
              if($id)
                {
                $num++;
                }
            }
            $id = $p_date[$i]['id'];
            if($p_date[$i]['id'] != $p_date[$i+1]['id'])
            {
                echo '<th>'.$num.'</th>';
                $num = 0;
            }
          
        }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m - d",strtotime("-1 day"));</php></th>
    <php>
        for($i = 0;$i < sizeof($p_date);$i++)
        {
                $date = $p_date[$i]['date'];
                if($p_date[$i]['id'] == $p_date[$i]['id'] && date("Y-m-d",strtotime("$date")) == date("Y-m-d",strtotime("-1 day")))
                {
                    $num++;
                }
          if($p_date[$i]['id'] != $p_date[$i+1]['id'])
            {
              echo '<th>'.$num.'</th>';
              $num = 0;
            }
          
        }
</php>
  </tr>
<tr>
    <th><php>echo date("Y - m - d",strtotime("-2 day"));</php></th>
    <php>
        for($i = 0;$i < sizeof($p_date);$i++)
        {
                $date = $p_date[$i]['date'];
                if($p_date[$i]['id'] == $p_date[$i]['id'] && date("Y-m-d",strtotime("$date")) == date("Y-m-d",strtotime("-2 day")))
                {
                    $num++;
                }
          if($p_date[$i]['id'] != $p_date[$i+1]['id'])
            {
              echo '<th>'.$num.'</th>';
              $num = 0;
            }
          
        }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m - d",strtotime("-3 day"));</php></th>
    <php>
        for($i = 0;$i < sizeof($p_date);$i++)
        {
                $date = $p_date[$i]['date'];
                if($p_date[$i]['id'] == $p_date[$i]['id'] && date("Y-m-d",strtotime("$date")) == date("Y-m-d",strtotime("-3 day")))
                {
                    $num++;
                }
          if($p_date[$i]['id'] != $p_date[$i+1]['id'])
            {
              echo '<th>'.$num.'</th>';
              $num = 0;
            }
          
        }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m - d",strtotime("-4 day"));</php></th>
    <php>
        for($i = 0;$i < sizeof($p_date);$i++)
        {
                $date = $p_date[$i]['date'];
                if($p_date[$i]['id'] == $p_date[$i]['id'] && date("Y-m-d",strtotime("$date")) == date("Y-m-d",strtotime("-4 day")))
                {
                    $num++;
                }
          if($p_date[$i]['id'] != $p_date[$i+1]['id'])
            {
              echo '<th>'.$num.'</th>';
              $num = 0;
            }
          
        }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m - d",strtotime("-5 day"));</php></th>
    <php>
        for($i = 0;$i < sizeof($p_date);$i++)
        {
                $date = $p_date[$i]['date'];
                if($p_date[$i]['id'] == $p_date[$i]['id'] && date("Y-m-d",strtotime("$date")) == date("Y-m-d",strtotime("-5 day")))
                {
                    $num++;
                }
          if($p_date[$i]['id'] != $p_date[$i+1]['id'])
            {
              echo '<th>'.$num.'</th>';
              $num = 0;
            }
          
        }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m - d",strtotime("-6 day"));</php></th>
    <php>
        for($i = 0;$i < sizeof($p_date);$i++)
        {
                $date = $p_date[$i]['date'];
                if($p_date[$i]['id'] == $p_date[$i]['id'] && date("Y-m-d",strtotime("$date")) == date("Y-m-d",strtotime("-6 day")))
                {
                    $num++;
                }
          if($p_date[$i]['id'] != $p_date[$i+1]['id'])
            {
              echo '<th>'.$num.'</th>';
              $num = 0;
            }
          
        }
</php>
  </tr>
  <tr>
    <th>上周</th>
  <php>
$Mon = date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1-7,date("Y")));
$Tue = date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+2-7,date("Y")));
$Wed = date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+3-7,date("Y")));
$Thu = date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+4-7,date("Y")));
$Fri = date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+5-7,date("Y")));
$Sat = date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+6-7,date("Y")));
$Sun = date("Y-m-d",mktime(23,59,59,date("m"),date("d")-date("w")+7-7,date("Y")));

          for($i = 0;$i < sizeof($p_date);$i++)
            {
                $date = $p_date[$i]['date'];
                if($p_date[$i]['id'] == $p_date[$i]['id'])
                {
                    if($Mon == date("Y-m-d",strtotime("$date"))){
                        $num++;
                    }
                    if($Tue == date("Y-m-d",strtotime("$date"))){
                        $num++;
                    }
                    if($Wed == date("Y-m-d",strtotime("$date"))){
                        $num++;
                    }
                    if($Thu == date("Y-m-d",strtotime("$date"))){
                        $num++;
                    }
                    if($Fri == date("Y-m-d",strtotime("$date"))){
                        $num++;
                    }
                    if($Sat == date("Y-m-d",strtotime("$date"))){
                        $num++;
                    }
                    if($Sun == date("Y-m-d",strtotime("$date"))){
                        $num++;
                    }
                }
                if($p_date[$i]['id'] != $p_date[$i+1]['id'])
                {
                    echo '<th>'.$num.'</th>';
                    $num = 0;
                }
            }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m ");</php></th>
        <php>
            for($i = 0;$i < sizeof($p_date);$i++)
            {
              if($p_date[$i]['id'] == $p_date[$i]['id']){
                    $date = $p_date[$i]['date'];
                    if(date("Y-m",strtotime("$date")) == date("Y-m")){
                        $num++;
                    }
                }
                if($p_date[$i]['id'] != $p_date[$i+1]['id'])
                {
                    echo '<th>'.$num.'</th>';
                    $num = 0;
                }
            }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m ",strtotime("-1 month"));</php></th>
        <php>
            for($i = 0;$i < sizeof($p_date);$i++)
            {
              if($p_date[$i]['id'] == $p_date[$i]['id']){
                    $date = $p_date[$i]['date'];
                    if(date("Y-m",strtotime("$date")) == date("Y-m",strtotime("-1 month"))){
                        $num++;
                    }
                }
                if($p_date[$i]['id'] != $p_date[$i+1]['id'])
                {
                    echo '<th>'.$num.'</th>';
                    $num = 0;
                }
            }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m ",strtotime("-2 month"));</php></th>
        <php>
            for($i = 0;$i < sizeof($p_date);$i++)
            {
              if($p_date[$i]['id'] == $p_date[$i]['id']){
                    $date = $p_date[$i]['date'];
                    if(date("Y-m",strtotime("$date")) == date("Y-m",strtotime("-2 month"))){
                        $num++;
                    }
                }
                if($p_date[$i]['id'] != $p_date[$i+1]['id'])
                {
                    echo '<th>'.$num.'</th>';
                    $num = 0;
                }
            }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m ",strtotime("-3 month"));</php></th>
        <php>
            for($i = 0;$i < sizeof($p_date);$i++)
            {
              if($p_date[$i]['id'] == $p_date[$i]['id']){
                    $date = $p_date[$i]['date'];
                    if(date("Y-m",strtotime("$date")) == date("Y-m",strtotime("-3 month"))){
                        $num++;
                    }
                }
                if($p_date[$i]['id'] != $p_date[$i+1]['id'])
                {
                    echo '<th>'.$num.'</th>';
                    $num = 0;
                }
            }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m ",strtotime("-4 month"));</php></th>
        <php>
            for($i = 0;$i < sizeof($p_date);$i++)
            {
              if($p_date[$i]['id'] == $p_date[$i]['id']){
                    $date = $p_date[$i]['date'];
                    if(date("Y-m",strtotime("$date")) == date("Y-m",strtotime("-4 month"))){
                        $num++;
                    }
                }
                if($p_date[$i]['id'] != $p_date[$i+1]['id'])
                {
                    echo '<th>'.$num.'</th>';
                    $num = 0;
                }
            }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y - m ",strtotime("-5 month"));</php></th>
        <php>
            for($i = 0;$i < sizeof($p_date);$i++)
            {
              if($p_date[$i]['id'] == $p_date[$i]['id']){
                    $date = $p_date[$i]['date'];
                    if(date("Y-m",strtotime("$date")) == date("Y-m",strtotime("-5 month"))){
                        $num++;
                    }
                }
                if($p_date[$i]['id'] != $p_date[$i+1]['id'])
                {
                    echo '<th>'.$num.'</th>';
                    $num = 0;
                }
            }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y",strtotime("-1 year"));</php></th>
        <php>
          for($i = 0;$i < sizeof($p_date);$i++)
            {
              if($p_date[$i]['id'] == $p_date[$i]['id']){
                    $date = $p_date[$i]['date'];
                    if(date("Y",strtotime("$date")) == date("Y",strtotime("-1 year"))){
                        $num++;
                    }
                }
            if($p_date[$i]['id'] != $p_date[$i+1]['id']){
          echo '<th>'.$num.'</th>';
            $num = 0;
            }
            }
</php>
  </tr>
  <tr>
    <th><php>echo date("Y");</php></th>
        <php>
          for($i = 0;$i < sizeof($p_date);$i++)
            {
              if($p_date[$i]['id'] == $p_date[$i]['id']){
                    $date = $p_date[$i]['date'];
                    if(date("Y",strtotime("$date")) == date("Y")){
                        $num++;
                    }
                }
            if($p_date[$i]['id'] != $p_date[$i+1]['id']){
          echo '<th>'.$num.'</th>';
            $num = 0;
            }
            }
</php>
  </tr>
  <tr>
    <th>总计</th>
<php>
            for($i = 0;$i < sizeof($p_date);$i++)
            {
              if($p_date[$i]['id'] == $p_date[$i]['id']){
                        $num++;
                }
            if($p_date[$i]['id'] != $p_date[$i+1]['id']){
          echo '<th>'.$num.'</th>';
            $num = 0;
            }
            }
</php>
  </tr>
  
</table>
    </ul>
  </div>
  <h4 class="well">二次开发</h4>
  <div class="home_info" id="home_devteam">
    <ul>
      <li> <em>服务器部分</em>	<span><s>靳思远</s>、臧金霞、李乐</span></li>
      <li> <em>后台部分</em> 	<span><s>王志新</s>、<s>靳思远</s>、<s>孙玉茹</s>、朱翠玲</span></li>
      <li> <em>前台部分</em> 	<span><s>王志新</s>、<s>陈晓辉</s>、<s>薛洪刚</s>、<s>崔胜男</s></span></li>
      <li> <em>设计部分</em> 	<span><s>魏叶红</s>、<s>陈晓辉</s>、<s>贾翠翠</s>、<s>薛洪刚</s>、<s>张嘉裕</s>、<s>邵岩</s></span></li>
      <li> <em>SEO部分</em>		<span><s>王志新</s>	</span></li>
    </ul>
  </div>
  <h4 class="well">版权团队</h4>
  <div class="home_info" id="home_devteam">
    <ul>
      <li> <em>ThinkCMF团队</em> <span>www.thinkcmf.com</span> </li>
      <li> <em>团队成员</em> <span>Dean,Sam,Tuolaji,Smile,Codefans,睡不醒的猪,Jack,日本那只猫</span> </li> <li> <em>贡献者</em> <span>Kin Ho,Powerless,Jess,木兰情,Labulaka,WelKinVan,Jeson,Yim,Jamlee</span> </li>
      <li> <em>联系邮箱</em> <span>cmf@simplewind.net</span> </li>
    </ul>
  </div>

</div>
<script src="__ROOT__/statics/js/common.js"></script> 
<script>
//获取官方通知
$.getJSON("http://www.thinkcmf.com/service/sms_jsonp.php?callback=?",function(data){
	var tpl='<li><em class="title"></em><span class="content"></span></li>';
	var $thinkcmf_notices=$("#thinkcmf_notices");
	$thinkcmf_notices.empty();
	if(data.length>0){
		$.each(data,function(i,n){
			var $tpl=$(tpl);
			$(".title",$tpl).html(n.title);
			$(".content",$tpl).html(n.content);
			$thinkcmf_notices.append($tpl);
		});
	}else{
		$thinkcmf_notices.append("<li>^_^,没有通知~~</li>");
	}
	
});
</script>
</body>
</html>